home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_gtk / INCLUDE / GTK / GTKRULER.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  110 lines

  1. /* GTK - The GIMP Toolkit
  2.  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Library General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  * Library General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Library General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __GTK_RULER_H__
  28. #define __GTK_RULER_H__
  29.  
  30.  
  31. #include <gdk/gdk.h>
  32. #include <gtk/gtkwidget.h>
  33.  
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif /* __cplusplus */
  38.  
  39.  
  40. #define GTK_RULER(obj)          GTK_CHECK_CAST (obj, gtk_ruler_get_type (), GtkRuler)
  41. #define GTK_RULER_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_ruler_get_type (), GtkRulerClass)
  42. #define GTK_IS_RULER(obj)       GTK_CHECK_TYPE (obj, gtk_ruler_get_type ())
  43.  
  44.  
  45. typedef struct _GtkRuler        GtkRuler;
  46. typedef struct _GtkRulerClass   GtkRulerClass;
  47. typedef struct _GtkRulerMetric  GtkRulerMetric;
  48.  
  49. /* All distances below are in 1/72nd's of an inch. (According to
  50.  * Adobe that's a point, but points are really 1/72.27 in.)
  51.  */
  52. struct _GtkRuler
  53. {
  54.   GtkWidget widget;
  55.  
  56.   GdkPixmap *backing_store;
  57.   GdkGC *non_gr_exp_gc;
  58.   GtkRulerMetric *metric;
  59.   gint xsrc, ysrc;
  60.   gint slider_size;
  61.  
  62.   /* The upper limit of the ruler (in points) */
  63.   gfloat lower;
  64.   /* The lower limit of the ruler */
  65.   gfloat upper;
  66.   /* The position of the mark on the ruler */
  67.   gfloat position;
  68.   /* The maximum size of the ruler */
  69.   gfloat max_size;
  70. };
  71.  
  72. struct _GtkRulerClass
  73. {
  74.   GtkWidgetClass parent_class;
  75.  
  76.   void (* draw_ticks) (GtkRuler *ruler);
  77.   void (* draw_pos)   (GtkRuler *ruler);
  78. };
  79.  
  80. struct _GtkRulerMetric
  81. {
  82.   gchar *metric_name;
  83.   gchar *abbrev;
  84.   /* This should be points_per_unit. This is the size of the unit
  85.    * in 1/72nd's of an inch and has nothing to do with screen pixels */
  86.   gfloat pixels_per_unit;
  87.   gfloat ruler_scale[10];
  88.   gint subdivide[5];        /* five possible modes of subdivision */
  89. };
  90.  
  91.  
  92. guint gtk_ruler_get_type   (void);
  93. void  gtk_ruler_set_metric (GtkRuler       *ruler,
  94.                 GtkMetricType   metric);
  95. void  gtk_ruler_set_range  (GtkRuler       *ruler,
  96.                 gfloat          lower,
  97.                 gfloat          upper,
  98.                 gfloat          position,
  99.                 gfloat          max_size);
  100. void  gtk_ruler_draw_ticks (GtkRuler       *ruler);
  101. void  gtk_ruler_draw_pos   (GtkRuler       *ruler);
  102.  
  103.  
  104. #ifdef __cplusplus
  105. }
  106. #endif /* __cplusplus */
  107.  
  108.  
  109. #endif /* __GTK_RULER_H__ */
  110.